/**
 * 
 */
package com.eis.admin.mvc.bean;

import java.io.Serializable;

import com.eis.persist.dao.util.Constants;
import com.eis.persist.model.user.PersistBizGroup;

/**
 * @author sh-panwei01
 *
 */
public class BizGroupBean implements Serializable {

	private static final long serialVersionUID = 4239434519159328431L;
	
	private int id;
	private String name;
	private int parentId;
	private String parentName;
	private int customizedParentId;
	private String customizedParentName;
	private int functionCount; 
	private int customized; // 1: true 0: false
	private String description;
	
	public int getRoot() {
		return Constants.DEFAULT_GROUP_NAME.equals(name) ? 1 :0;
	}
	
	public BizGroupBean(){}
	
	public BizGroupBean(PersistBizGroup oneGroup) {
		this.id = oneGroup.getId();
		this.name = oneGroup.getName();
		this.customized = oneGroup.isConfiged() ? 1 : 0;
		this.description = oneGroup.getDescription();
		if (oneGroup.getParent() != null) {
			this.parentId = oneGroup.getParent().getId();
		}
	}
	public boolean isFilterable() {
		return name != null && name.trim().length() > 0;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public String getParentName() {
		return parentName;
	}
	public void setParentName(String parentName) {
		this.parentName = parentName;
	}
	public int getFunctionCount() {
		return functionCount;
	}
	public void setFunctionCount(int functionCount) {
		this.functionCount = functionCount;
	}
	public int getCustomized() {
		return customized;
	}
	public void setCustomized(int customized) {
		this.customized = customized;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	public int getParentId() {
		return parentId;
	}

	public void setParentId(int parentId) {
		this.parentId = parentId;
	}

	public int getCustomizedParentId() {
		return customizedParentId;
	}

	public void setCustomizedParentId(int customizedParentId) {
		this.customizedParentId = customizedParentId;
	}

	public String getCustomizedParentName() {
		return customizedParentName;
	}

	public void setCustomizedParentName(String customizedParentName) {
		this.customizedParentName = customizedParentName;
	}
	
}
